import { SelectivePreloadingStrategyService } from './../../selective-preloading-strategy.service';
import { ActivatedRoute } from '@angular/router';
import { Observable,map } from 'rxjs';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-admin-dashboard',
  templateUrl: './admin-dashboard.component.html',
  styleUrls: ['./admin-dashboard.component.css']
})
export class AdminDashboardComponent implements OnInit {

  sessionId!:Observable<string>;
  token!:Observable<string>;
  // 在dashboard中 用来验证 预加载的路由名是否正确
  modules: string[] = []


  constructor(private router:ActivatedRoute,private preLoadStratety: SelectivePreloadingStrategyService) {

     this.modules = preLoadStratety.preLoadedModules
  }

  ngOnInit(): void {

    this.sessionId = this.router.queryParamMap.pipe(
        map((params:any) => params.get('sessionID' || 'None'))
    )

    this.token = this.router.fragment.pipe(
        map(fragment => fragment || 'None')
    )




  }

}
